<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8"/>
		<title>强制数据类型转换</title>
	</head>
	<body>
		<script type="text/javascript">
		/* 
		var a = '123';
		var a1 = parseInt(a,10);
		console.log(a1);
		
		//其他数据转为数字
		var a = '123';
		var a1 = Number(a);
		console.log(a1);
		var b = '1.456';
		var b1 = Number(b);
		console.log(b1);
		console.log(typeof(b1));

		var c = true;
		var c1 = Number(c);
		console.log(c1);

		console.log(Number(null));
		
		console.log(Number(undefined));
		*/
		
		
		//转化为字符串
	/* 	var a = 123+"";
		console.log(a);
		console.log(typeof a);

		var b = 456;
		console.log(b.toString(2));

		var c = null;
		console.log(String(c));
		var d = undefined;
		console.log(String(d)); */

		
		//转化为boolean值
	/* 	console.log(Boolean(0));
		console.log(Boolean(NaN));

		console.log(Boolean(""));

		console.log(Boolean(null));
		console.log(Boolean(undefined));

		console.log(Boolean(Object)); */


				
		</script>
	</body>
</html>